#pragma once
#include <cstdlib>
#include <iostream>

namespace NSTask
{
    class task
    {
    private:
        int _x;
        int _y;
        char _ch;

    public:
        task() = default;
        task(const int &x, const int &y, const char &ch)
            : _x(x), _y(y), _ch(ch)
        {
        }

        int Run()
        {
            int ret = 0;
            switch (_ch)
            {
            case '+':
                ret = _x + _y;
                break;
            case '-':
                ret = _x - _y;
                break;
            case '*':
                ret = _x * _y;
                break;
            case '/':
                ret = _x / _y;
                break;
            case '%':
                ret = _x % _y;
                break;
            default:
                exit(1);
            }
            std::cout << "我是[" << pthread_self() << "] : " << _x << _ch << _y << "=" << ret << std::endl;
            return ret;
        }

        int operator()()
        {
            return Run();
        }

        void Show()
        {
            std::cout << _x << _ch << _y << "=?";
        }
    };
}